"""
财务首页
"""

from page.base_page import BasePage
from selenium.webdriver.common.by import By

class FinancePage(BasePage):
    url = 'http://192.168.1.25/crm/index.php?m=finance&a=index&t=receivables'

    #定位器

    yfk_btn_locator = (By.LINK_TEXT, '应付款') #点击应付款
    skd_locator = (By.LINK_TEXT, '收款单') #点击收款单
    fkd_locator = (By.LINK_TEXT, '付款单') #点击付款单
    xj_ysk_locator = (By.CSS_SELECTOR, 'body > div.container > div.row > div:nth-child(1) > div.pull-right > a:nth-child(1)')
    xg_locator = (By.LINK_TEXT, '修改') #点击应收款修改
    sousuo_locator = (By.ID, 'search') #搜索输入框
    sousuo_btn_locator = (By.CSS_SELECTOR, '#searchForm > ul > li:nth-child(4) > button') #点击搜索按钮
    table_locator = (By.CSS_SELECTOR,'#form1 > table > tbody')
    div_locator = (By.XPATH,'/html/body/div[5]/div[2]')
    #操作方法
    #点击应付款
    def click_yfk_btn(self):
        self.driver.find_element(*self.yfk_btn_locator).click()

    #点击收款单
    def click_skd_btn(self):
        self.driver.find_element(*self.skd_locator).click()
    #点击付款单
    def click_fkd_btn(self):
        self.driver.find_element(*self.fkd_locator).click()
    #点击添加应收款
    def click_tj_ysk_btn(self):
        self.driver.find_element(*self.xj_ysk_locator).click()
    #点击修改按钮
    def click_xg_btn(self):
        self.driver.find_element(*self.xg_locator).click()
    #搜索输入框,输入搜索的名字
    def input_sousuo(self,name):
        self.driver.find_element(*self.sousuo_locator).send_keys(name)
    #点击搜索按钮
    def click_sousuo_btn(self):
        self.driver.find_element(*self.sousuo_btn_locator).click()
    # #获取表格
    # def get_table_element(self):
    #     return self.driver.find_element(*self.table_locator)

    #保存
    def ysk_bccg_text(self):
        return self.driver.find_element(*self.div_locator).get_attribute("class")


